package com.qf.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.feign.CityFeign;
import com.qf.entity.City;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/system")
@Slf4j
public class SystemController {

    @Autowired
    private CityFeign cityFeign;

    /**
     * 跳转到home页面
     * @return
     */
    @RequestMapping("/home")
    public String toHome(){
        return "home";
    }

    /**
     * 新增城市列表
     * @return
     */
    @RequestMapping("/tocityadd")
    public String toCityAdd(){
        return "cityadd";
    }

    /**
     * 跳转到酒店新增页面
     * @return
     */
    @RequestMapping("/tohotaladd")
    public String toHotalAdd(Model model){

        //查询城市列表
        Page<City> page = cityFeign.cityList(-1).getData();
        model.addAttribute("citys", page.getRecords());

        return "hotaladd";
    }

}
